# _*_ coding: utf-8 _*_
"""
Time:     2022/3/23 22:47
Author:   suhong
Version:  V 0.1
File:     login_test.py
"""
import unittest

import parameterized as parameterized

from base.public import GetPath, GetExcelDate
from page.login import LoginPage
from page.login_page import CoolPage


class LoginTest(unittest.TestCase):
    excel_path=GetPath().get_path(r'\datas\loging.xlsx')
    a=GetExcelDate().get_excel_data(excel_path,"loging_file")
    def setUp(self):
        self.page=LoginPage()
    def tearDown(self):
        self.page.basedriver.quit_windows()
    @parameterized.parameterized.expand(a)
    def test_1(self,index,expectation):
        title_result=self.page.send_text()
        try:
            '''
            断言
            '''
            self.assertEqual(title_result,expectation,"获得的文本一致")
            self.page.logs.info(f"获的百度title,等{index}条成功")
        except AssertionError:
            self.page.logs.debug(f"跳转百度众测，第 {index} 条出现了错误，实际结果{title_result},期望结果{expectation} 不一致")
            raise AssertionError(f"第 {index} 条用例执行完毕，结果：失败，实际结果 {title_result} ,期望结果: {expectation}")
if __name__=="__main__":
    unittest.main()






